package  
{
	import net.flashpunk.Entity;
	import net.flashpunk.FP;
	import net.flashpunk.graphics.Image;
	/**
	 * © 2012 TheJavaArcade.com
	 */	
	public class Umbrella extends Entity {
		public var umbrellaSprite:Image = new Image(Assets.UMBRELLA_SPRITE);
		public var level:int;
		public var state:int;
		
		public function Umbrella(theLevel:int) {
			level = theLevel;
			graphic = umbrellaSprite;
			layer = -1;
			state = 0;
			visible = false;
			setHitbox(16, 16, 0, 0);
		}
		
		override public function update():void {
			if (state == 1 && GameEngine.level == level) {
				if (collide("fracas", x, y)) {
					GameEngine.score += 5000;
					state = 2;
					umbrellaSprite.scale = .5;
					layer = -5;
					GameEngine.butterfly.state = 2;
				}
			}
			
		}
	}

}